import os

# 定义服务器数据（类型: 名称列表）
server_data = {
    "服务器": [42, 48, 51, 52, 53, 55],
}

N_WAN_IP = '192.168.1.140'
W_WAN_IP = '113.106.121.101'
PORT = 15554

CMD_LEN = 4  # 1字节CMD字段
BODY_LEN = 4  # 4字节消息长度
HEADER_LEN = CMD_LEN + BODY_LEN  # 总包头长度
byteorder_big = 'big'  # 大端字节序
MSG_LEN = 1024  # 消息体最大长度

# 定义常量路径 (建议挪到config.py)
PYTHON_SCRIPT_DIR = os.path.join(os.getcwd(), 'server/python_script')
SHOW_SCRIPT_DIR = os.path.join(PYTHON_SCRIPT_DIR, 'show')
BASH_SCRIPT_DIR = os.path.join(PYTHON_SCRIPT_DIR, 'bash')
# MAIN_SERVER_ID = 109  # 主干服ID
STATE_STOP = 0
STATE_RUN = 1
NONE_NAME = ""

# 版本号
VERSION = 20250422

CMD_REQ = 1
CMD_RSP = 2
CMD_NTF = 3
CMD_SVN_INFO_NTF = 4
CMD_SERVER_LIST_NTF = 5

TRANS_TYPE_LOGIN = 1
TRANS_TYPE_CHECK_SVR = 2
TRANS_TYPE_GET_SVR_DATA = 3
TRANS_TYPE_LOCK_SVR = 4
TRANS_TYPE_AUTOMAKE = 5
TRANS_TYPE_KILL_CFG = 6
TRANS_TYPE_RELOAD = 7
TRANS_TYPE_STOP = 8
TRANS_TYPE_DEL_SVR = 9
TRANS_TYPE_SYN = 10
TRANS_TYPE_DUMP = 11
TRANS_TYPE_SET_SVR_TIME = 12
TRANS_TYPE_ASK = 13
TRANS_TYPE_SVN_INFO = 14
TRANS_TYPE_ENTER = 15
TRANS_TYPE_CHANGE_SET_ID = 16
TRANS_TYPE_CHANGE_GM_STATE = 17


RET_SUCCESS = 0
RET_FAIL = 9999
RET_FAIL_10001 = 10001      # 服务器不存在
RET_FAIL_10002 = 10002      # 服务器运行中
RET_FAIL_10003 = 10003      # 不是主干服，别闹
RET_FAIL_10004 = 10004      # 版本对不上
RET_FAIL_10005 = 10005      # 编译错误
RET_FAIL_10006 = 10006

PAGE_ENTER = 0
PAGE_SERVER_LIST = 1
PAGE_SERVER_MAIN = 2
PAGE_SERVER_FUNC = 3